Systems and methods for uniquely identifying networks by correlating each network name with the application programming interfaces of transport protocols supported by the network

ABSTRACT

A service is disclosed that discovers information about the logical networks to which a computer is connected and provides that information  to applications. The information is keyed to names constructed by the service. There is a mapping between the names and the logical networks. Applications may rely on the names when selecting a configuration to use with a given logical network. The network name may be correlated with other information, such as physical network interface(s) on the computer through which the logical network is accessible, application programming interfaces of the transport protocols supported by the logical network, and the connectivity type of the logical network. Applications are notified when network information provided to them changes or when new information becomes available.

RELATED APPLICATION

This application is a continuation in part of application Ser. No.09/557,497, filed on Apr. 24, 2000 now abandoned.

TECHNICAL FIELD

This invention relates generally to computer networks and, morespecifically, to identifying the networks to which a computer isattached.

BACKGROUND OF THE INVENTION

Computers today connect to and disconnect from networks much morefrequently than they did in the past. Laptops move around among one ormore office networks and the home network. As a mobile computer with aradio network link passes from one radio access point to another, itsnetwork connection is, in effect, dropped and then reinstated.

Some computers can automatically sense when they are connected to anetwork and when that network connection changes. These computers arecalled “media sense aware.” Media sense awareness is very useful in manycommon computing scenarios because computers, applications, and systemservices may want to alter their behavior depending upon the network towhich the computer is connected. For example, when a non-media senseaware computer's link is disconnected from one network and connected toanother, an application that transmits secure information may notrealize the change and may inadvertently leak that secure informationout onto the new network. Likewise, a non-media sense aware systemservice that obeyed the bandwidth reservation guarantees given by aQuality of Service manager on a previous network may inadvertentlyviolate the bandwidth guarantees on the new network. Mobile computersare specially sensitive to problems if they are not media sense awarebecause of their frequent network disconnects and subsequent connects.

Some media sense aware computers, applications, and system services canonly respond to network connect and disconnect events. U.S. patentapplication Ser. No. 09/652,501, “Systems and Methods forResynchronization and Notification in Response to Network Media Events,”filed on Aug. 31, 2000 now U.S. Pat. No. 6,782,422, expands on thatbasic functionality, allowing response to a broad range of networkevents. However, even when media sense aware applications and servicesknow about a change in the status of their network connections, they maynot have enough information to know how to respond, unless a usermanually reconfigures them for their changed circumstances. Theapplications and services may be able to enumerate the networkinterfaces available on a computer but do not know to which logicalnetwork an interface connects nor whether multiple interfaces connect tothe same network. This information is often needed, however, when theapplications and services attempt to select an optimal configuration touse with the new network connectivity. They are left having to discovernetwork information themselves before they can respond appropriately.The problem is especially acute for mobile computers that frequentlymove among different networks and for computers for which more than onenetwork connection is available, such as multi-homed computers that maysupport both a LAN connection and a dial-out link.

Forcing each application and system service to discover networkconnectivity information creates further problems because there aremultiple ways in which logical network connections may be determined,depending upon the types of the connections.

SUMMARY OF THE INVENTION

The above problems and shortcomings, and others, are addressed by thepresent invention, which can be understood by referring to thespecification, drawings, and claims. The present invention discoversinformation about the logical networks to which a computer is connected.The information is provided to applications running on the computer, theinformation keyed to names constructed by the invention. There is a“one-to-one” mapping between the names and the logical networks. Thisone-to-one mapping has two fundamental properties. First, differentlogical networks are given different names. Second, a given logicalnetwork is given the same name whenever the computer connects to it.These properties are called “uniqueness” and “persistence,”respectively. Because the network names are unique and persistent,applications may rely on them when selecting a configuration to use witha given logical network. Even though some embodiments of the inventionmay, in certain circumstances, produce mappings that are not strictlyunique or persistent, the information they produce may still be valuablein selecting a configuration.

According to another aspect of the present invention, the network nameis correlated with other information, such as physical networkinterface(s) on the computer through which the logical network isaccessible, application programming interfaces of the transportprotocols supported by the logical network, and the connectivity type ofthe logical network. Applications are notified when network informationprovided to them changes or when new information becomes available.

BRIEF DESCRIPTION OF THE DRAWINGS

While the appended claims set forth the features of the presentinvention with particularity, the invention, together with its objectsand advantages, may be best understood from the following detaileddescription taken in conjunction with the accompanying drawings ofwhich:

FIG. 1 shows a community of computer systems connected by multiplenetworks;

FIG. 2 is a block diagram generally illustrating an exemplary computersystem that supports the present invention;

FIG. 3 presents the International Standards Organization Open SystemsInterconnection (ISO/OSI) model for hierarchically-layered networkcommunications protocols;

FIG. 4A is a block diagram showing some of the functions involved inrunning a hierarchically-layered network communications protocol on acomputer system;

FIG. 4B is a block diagram presenting one possible implementation of thefunctions described with respect to FIG. 4A;

FIG. 5 is a flow diagram showing how one embodiment of the presentinvention provides network connection information to applications;

FIG. 6A shows a laptop PC and three locations where the laptop's ownermay wish to use it;

FIG. 6B shows, for each of the three locations of FIG. 6A, the networkinformation provided and the configuration a particular application maychoose when connected to a logical network at that location;

FIGS. 7A and 7B show a virtual private network connection from a user'shome to her office and the information provided about thisconfiguration;

FIGS. 8A through 8C show two computing devices using the Network AddressTranslator to share a connection to the Internet and the informationprovided about this configuration;

FIG. 9 presents a circumstance in which some embodiments of theinvention may return the same name for different networks;

FIGS. 10A and 10B present a situation in which some embodiments of theinvention may return different names for the same network;

FIG. 11A is a network diagram showing a computing device connected tofour different types of networks;

FIG. 11B is a flowchart showing how to determine the connectivity typesof the networks of FIG. 11A;

FIG. 11C is a flowchart showing how to determine whether a network hasconnectivity to the Internet; and

FIG. 11D is a block diagram showing network connectivity type andInternet connectivity information for the four networks of FIG. 11A.

DETAILED DESCRIPTION OF THE INVENTION

Turning to the drawings, wherein like reference numerals refer to likeelements, the invention is illustrated as being implemented in asuitable computing environment. The following description is based onexemplary embodiments of the invention and should not be taken aslimiting the invention in any way. Sections I through IV describe mediasense awareness and notifications of changes in network connectivity.These sections are based on U.S. patent application Ser. No. 09/652,501,“Systems and Methods for Resynchronization and Notification in Responseto Network Media Events.” Sections V and VI build on the previoussections, describing aspects of the present invention as a service thatidentifies the logical networks to which a computer is attached.

In the description that follows, the invention is described withreference to acts and symbolic representations of operations that areperformed by one or more computers, unless indicated otherwise. As such,it is understood that such acts and operations, which are at timesreferred to as being computer-executed, include the manipulation by theprocessing unit of the computer of electrical signals representing datain a structured form. This manipulation transforms the data or maintainsthem at locations in the memory system of the computer, whichreconfigures or otherwise alters the operation of the computer in amanner well understood by those skilled in the art. The data structureswhere data are maintained are physical locations of the memory that haveparticular properties defined by the format of the data. However, whilethe invention is being described in the foregoing context, it is notmeant to be limiting as those of skill in the art will appreciate thatvarious of the acts and operations described hereinafter may also beimplemented in hardware.

I. Sensing Network Media Events

Sections following this one discuss how computer systems may respondwhen they sense network media events. This section provides informationabout the events themselves.

In FIG. 1, several computer systems with different communicationsmechanisms are configured to communicate with one another. While FIG. 1shows all of the computing devices as resembling general-purposecomputers, they may in practice range from multiprocessor mainframes topersonal digital assistants, telephones, set top boxes for televisions,etc. A LAN 106 connects a first computing device 100, a server 102, anda router 104. The router also has a communications link to aninternetwork 108 which may be a corporate intranet or the Internet. Asecond computing device 110 connects to the internetwork 108 by way of adial-up modem 112 and telephone line. A third computing device 114 useswireless technology to communicate. The wireless technology may be, forexample, infrared or optical, but this example portrays a radioconnection. Two radio access points (RAPs), 116 and 118, are connectedto the internetwork 108 and may enable the third computing device 114 tocommunicate with the other computing devices connected to theinternetwork. The first computing device 100 can also communicate viawireless means, in addition to using the LAN 106.

FIG. 2 is a block diagram generally illustrating an exemplary computersystem that supports the present invention. The computing device 100 isonly one example of a suitable environment and is not intended tosuggest any limitation as to the scope of use or functionality of theinvention. Neither should the computing device 100 be interpreted ashaving any dependency or requirement relating to any one or combinationof components illustrated in FIG. 2. The invention is operational withnumerous other general-purpose or special-purpose computing environmentsor configurations. Examples of well-known computing systems,environments, and configurations suitable for use with the inventioninclude, but are not limited to, personal computers, servers, hand-heldor laptop devices, multiprocessor systems, microprocessor-based systems,set-top boxes, programmable consumer electronics, network PCs,minicomputers, mainframe computers, and distributed computingenvironments that include any of the above systems or devices. In itsmost basic configuration, computing device 100 typically includes atleast one processing unit 200 and memory 202. The memory 202 may bevolatile (such as RAM), non-volatile (such as ROM, flash memory, etc.),or some combination of the two. This most basic configuration isillustrated in FIG. 2 by the dashed line 204. The computing device mayhave additional features and functionality. For example, computingdevice 100 may include additional storage (removable and non-removable)including, but not limited to, magnetic and optical disks and tape. Suchadditional storage is illustrated in FIG. 2 by removable storage 206 andnon-removable storage 208. Computer-storage media include volatile andnon-volatile, removable and non-removable, media implemented in anymethod or technology for storage of information such ascomputer-readable instructions, data structures, program modules, orother data. Memory 202, removable storage 206, and non-removable storage208 are all examples of computer-storage media. Computer-storage mediainclude, but are not limited to, RAM, ROM, EEPROM, flash memory, othermemory technology, CD-ROM, digital versatile disks (DVD), other opticalstorage, magnetic cassettes, magnetic tape, magnetic disk storage, othermagnetic storage devices, and any other media which can be used to storethe desired information and which can accessed by computing device 100.Any such computer storage media may be part of the computing device. Thedevice 100 may also contain communications connections 210 that allowthe device to communicate with other devices. Communications connections210 are examples of communications media. Communications media typicallyembody computer-readable instructions, data structures, program modules,or other data in a modulated data signal such as a carrier wave or othertransport mechanism and include any information delivery media. The term“modulated data signal” means a signal that has one or more of itscharacteristics set or changed in such a manner as to encode informationin the signal. By way of example, and not limitation, communicationsmedia include wired media, such as wired networks (including the LAN 106of FIG. 1) and direct-wired connections, and wireless media such asacoustic, RF, infrared, and other wireless media. The termcomputer-readable media as used herein includes both storage media andcommunications media. The computing device 100 may also have inputdevices 212 such as a keyboard, mouse, pen, voice-input device,touch-input device, etc. Output devices 214 such as a display, speakers,printer, etc., may also be included. All these devices are well know inthe art and need not be discussed at length here.

Network logic within a computing device constantly monitors thecharacteristics of the physical medium that links the device to anetwork. Very generally, when that logic senses a change in the medium'scharacteristics, the logic reacts, possibly changing the way the deviceconnects to the network. Also, the network logic informs applicationsrunning on the device of the change so that they may reactappropriately. The following examples of network media events will aidin understanding the teachings of the present invention. Sectionsfollowing this one describe in detail responses to the sensed change,both from the network logic and from the applications.

In a first example, assume that the computing device 100 is monitoringits link to the LAN 106 for the most fundamental of network mediaevents: a media disconnect. In a media disconnect event, all incomingand outgoing traffic fails on the link. The manner in which a disconnectevent is sensed may vary with the type of link. On some links, thecomputing device may sense the disconnect immediately while in others,the computing device may not know until a certain amount of time passeswithout detectable activity on the link. In any case, the response isusually the same with the computing device first attempting to reconnectto the network over the link. Failing that, the computing device mightattempt to communicate over another link. This particular computingdevice may try the latter strategy because it has a radio transmitter.With the LAN inaccessible, the computing device may be able to rerouteits traffic to RAP A 116 and then on to the other devices.

The complement of a media disconnect event is a media connect event. Thecomputing device 100 may note that its connection to the LAN 106 is nowworking again. If that connection is faster or cheaper than thecomputing device's radio link, the computing device 100 may reroute itstraffic off the radio link and back onto the LAN. In one embodiment ofthe present invention, the computing device 100 keeps track of how longthe link was disconnected. If the disconnect period was very short, thenthe computing device proceeds to use the link as if nothing happened.For longer disconnects, however, procedures running on the computingdevice or on other devices may have timed out. In such a situation, thecomputing device needs to reestablish the network link as if it wereconnecting for the first time. Devices that are not always connected toa network, such as the computing device 110 that dials in, must gothrough this new connection routine whenever they access a network. Tocomplicate matters, the computing device cannot always assume that thenetwork to which it is now connected is the same network to which it wasconnected before the media disconnect event. In one embodiment of thepresent invention, the computing device performs some type of discoveryto learn the nature of the newly connected network.

Wireless complicates these simple scenarios of media disconnect andconnect events. Assume that the computing device 114 is using itstransmitter to access devices via RAP A 116. Assume also that thecomputing device 114 is moving away from RAP A toward RAP B 118. Whilemoving, the computing device monitors the strength of the signals comingfrom the two RAPs. The strength of RAP A's signal could suddenly go tozero which would be analogous to the LAN media disconnect eventdiscussed above, but it is much more likely that the signal willgradually fade. Sensing the fade, the computing device may try toconnect to RAP B even while the signal from RAP A is still tolerable.Thus, a wireless link is susceptible to more than simple mediadisconnect and connect events because the wireless link is not just “up”or “down” but may be “better” or “worse” or “mostly the same” as one ormore other available links. A wireless computing device may need toclosely monitor all available links in order to make intelligenttransmission choices.

This radio scenario hints at more complications of wirelesscommunications. A wired device usually knows how many connections it canhave: at most, one per network interface. A wireless device, on theother hand, has a potential connection to each access point whose signalstrength is above a given threshold and these access points may appearand disappear unpredictably. This exacerbates the problem mentionedabove in relation to wired networks: a connect following a disconnectneed not be to the same network. In one embodiment of the invention,wireless links are checked to see to what they are connecting.

Going beyond media disconnect and connect events, network logic maydetect a change in the error rate of data transmitted over the link.This may be due to link degradation, such as when a standard telephoneline gets wet, when a radio access point moves farther away, or when aradio link suffers from increased interference. The increased error ratemay also be caused by a defective network interface card connected tothe network, or may simply be a result of increased traffic loads on thenetwork. If the detected error rate exceeds a certain amount, then thenetwork logic may look to use another network link, even though thecurrent link is not in any sense disconnected.

The effective data rate that a computing device gets from a network linkmay decrease, independently of any increase in the error rate on thelink. This may be due to increased use by others of a shared link or bylink logic changing the link's transmission characteristics toaccommodate changes in its operating environment. The response couldwell be the same as for an increased error rate: the network logic couldsearch for another link.

Devices may want to respond to changing conditions before they result inactual errors. For example, network logic may sense that the responsetime on a network link is increasing substantially, although it is stillwithin the parameters formally defined as acceptable for this type ofnetwork link. By definition, this is not an error condition, but thenetwork logic may still use this information in considering whether tosend traffic by a different route.

Other types of media events can be sensed including a change in thelatency experienced by packets traversing the network, a change in thevariation in latency (jitter), a change in the maximum packet sizeallowed on the network, etc. Responses can be developed for many ofthese events.

The above examples begin to show the richness of the informationavailable to a device that is critically aware of the state of itsnetwork media. The following sections build on this richness to showsome of things that can be done with this information.

II. An Implementation of the Network Logic

Before detailing how the network logic responds to network media eventsthat it senses, it may help to have in mind one particular embodiment ofthat network logic. On each computing device in FIG. 1, network logicimplements the communications protocols used. Many, but not quite all,of today's communications protocols follow the International StandardsOrganization Open Systems Interconnection (ISO/OSI) protocol model shownin FIG. 3. In this model, the overall task of enabling networkcommunications is divided into subtasks and those subtasks are eachassigned to a logical layer in the protocol stack. The stack ishierarchical: each layer has a defined interface with the layers aboveand below it. Logically, each layer communicates with its peer layer onanother computer, provides services to the layer above it in the stack,and uses the services provided by the layer below it. Physically, dataflow down the stack from their originator until the physical layer 300actually transmits them across the medium of the network connection,shown here as a LAN 106. When the data are received by the targetcomputer, they are passed up the stack with each layer stripping off andresponding to the data meant for it while passing the rest of the dataup to the next level. For example, the network layer 304 defines howdata are routed among networks. The network layer on one computerlogically speaks with the network layer on another computer by passing apacket of data down to the data layer 302 on its own computer. The datalayer in turn adds a header to the network layer's packet thus creatinga data frame which it passes to the physical layer. The physical layeruses the physical network medium to transmit that data frame. When thedata frame is received by the target computer, the target's data layerreads the data frame, stripping from it the header information meant forits own use. Then the data layer takes the rest of the frame, consistingof the originator's data packet, and sends it up to the network layer.Thus, the network layer on the target reads the data as sent by thenetwork layer on the originator without having to decode the data layerheader and other information used by the lower layers to transmit thedata packet.

The primary advantage of this scheme is that application programs 306can communicate with each other without concerning themselves with themyriad details of establishing and maintaining a network connection.Protocol layers find the remote application programs with which theoriginating application program wishes to speak, retransmit informationdamaged during transmission, ensure that information is received inorder, reroute information when communications links fail, and do allthe other tasks necessary to present as flawless as possible aconnection to the application programs.

It should be remembered that the ISO/OSI protocol stack is a conceptualmodel only and that no protocol follows it exactly. However, manypopular protocols in use today follow this model to a greater or lesserextent and the model makes discussion of the communications tasks itdefines more easily comprehendible.

The ISO/OSI model does not, however, specify how a computing device 100should internally implement the tasks required to support an ISO/OSIlayered communications protocol. FIG. 4A shows one possibleimplementation of a computing device supporting the popular TransmissionControl Protocol/Internet Protocol (TCP/IP) stack. In this embodiment,but not necessarily in all embodiments, communications flow up and downa stack of computing components that is closely analogous to the layeredstack in the ISO/OSI model. Network communications services arepresented to the application program 306 by the socket layer 400. Thesocket layer insulates the application program from the details of theISO/OSI communications protocol. This insulation is especially valuablewhen a computing device is connected to more than one network andrunning more than one communications protocol. (For an example of this,see FIG. 4B.) When the application program calls a routine in the socketlayer to send data to an application program on another computingdevice, the request works its way down the stack of protocol componentswith each component communicating with its peer on the other computingdevice as per the ISO/OSI model. Even in this embodiment, however, somecomponents do not map directly to ISO/OSI layers. Some protocols do notimplement all of the ISO/OSI layers, as shown here by the lack of aspecific layer 5 (Session Layer) component. An implementation may alsocombine the functionality of several ISO/OSI layers into one component.In FIG. 4A, layers 3 (Network Layer) and 4 (Transport Layer) aresupported by a combined TCP/IP driver 406. A complicated protocol suchas TCP/IP requires functions beyond the simple transport of data. InFIG. 4A, these functions are represented by the 802.1X component 402,which provides authentication services, and by the dynamic hostconfiguration protocol (DHCP) service 404, which provides for non-staticnetwork addresses.

FIG. 4B is a more specific version of FIG. 4A and illustrates anembodiment of network communications tasks within Microsoft's “WINDOWS”operating system. This embodiment is useful for illustrating how thenetwork logic responds to sensed media events, as described in the nextsection. For the moment, note that there is often more than onecommunications task at a given layer. ISO/OSI's physical layer 300 isdivided in this implementation between connection-oriented physicallayer drivers 414, such as for the Asynchronous Transfer Mode 416, andconnectionless physical layer drivers 418, such as for Ethernet 420.Again, one computer may simultaneously implement two sets of ISO/OSIlevels 3 and 4, once as TCP running over IP 406, and once as theAppletalk protocol 422. This redundancy gives to the network logic theflexibility to reroute information from one protocol stack to anotherwhen it senses a disruption in the service provided by one of thestacks.

III. Actions of the Network Logic in Response to Network Media Events

According to one embodiment of the present invention, having sensed oneof the several types of network media events discussed above, thenetwork logic analyzes that event and responds in a manner calculated tobest preserve effective communications. The response varies not onlywith the event, but with the existing communications environment, withthe computing device on which the network logic is running, and with thespecific implementation of the network logic. This section detailsresponses to some events, taking examples from one possibleimplementation of the network logic. For purposes of illustration, thecomputing device is taken to be the general-purpose computer 100 of FIG.1, connected to a TCP/IP network 106. In general, however, the computingdevice may be any device connected to any communications link, such as anetworked printer or even a telephone, etc.

On a Media Disconnect Event

In a preferred embodiment, when a physical layer driver (418 in FIG. 4B)detects that its network media has been disconnected, it passes anotification of the event up the protocol stack to the Network DeviceInterface Specification (NDIS) 424. NDIS uses the IPStatus callbackfunction to pass the notification to the TCP/IP driver 406.

At this point, the TCP/IP driver 406 may choose to wait for a short timeand then query the lower protocol levels for the status of the networkconnection media. If the problem has been cleared up, then the TCP/IPdriver need do nothing more. This strategy smoothes out transientproblems without having to inform the application programs 306.

If a computing device is equipped with more than one network interface(as is the case, for example, with the first computing device 100 inFIG. 1), then the network logic attempts to reroute traffic intended forthe failed network interface 420 to another network interface. In oneembodiment of the present invention, this reroute is done entirelywithin the protocol stack, transparently to the application programs306. Note, however, that even if traffic can be rerouted, the TCP/IPdriver 406 may choose to remove the address (or mark it unusable) andgive an “IP address deletion” notification. This allows media senseaware applications to synchronize to the new state, if necessary. Forexample, routing software can respond to an immediate notification of amedia disconnect or connect event. The routing software can then use itsrouting protocol to tell other routers about the event.

If a second network interface is available, the network logic may needto perform one or more of the following operations, in addition torerouting traffic.

-   -   Automatic Virtual Private Network Failover. If a tunnel to a        server was set up over the failed network interface 420, a new        tunnel may be set up over the second network interface. Even if        no tunnel was set up on the failed network interface, a new        tunnel may have to be set up if the second network interface        connects to a network different from that of the failed network        interface. In either case, tunnel setup requires more than a        simple change to the routing table. The tunneling client        software must run the tunnel setup logic with the same (if        accessible and preferable) or with another tunnel server. The        tunneling client software may be configured with the name or        address of the other tunnel server, or it may query the Domain        Name System (DNS) over the second network interface.    -   Automatic Address Failover. If the second network interface        connects to the same network as did the failed network interface        420, then the second interface can move from being passive        (connected to the network but with no address) to being active        by taking over the address of the failed network interface. Even        if the second interface was active before the failure, it can        still take the address of the failed interface. This makes the        disconnect event transparent to the end stations communicating        with this computing device via the failed-over TCP/IP address.    -   Binding Update. The computing device 100 can send an IPv6        binding update message to tell a remote computer 110 that the        TCP/IP address associated with the TCP connect message is now        connected to the second IP address rather than to the failed        address.

If the problem persists and traffic cannot be transparently rerouted,then the TCP/IP driver 406 removes the TCP/IP address associated withthe failed network interface 420 and passes an “IP address deletion”notification up the stack. Application programs 306 receive thatnotification through the Transport Driver Interface 426, IPHLPAPIcallbacks, the Winsock API (Application Program Interface), orMicrosoft's Windows Management Instrumentation. The notification allowsusers of the TCP/IP protocol stack to operate in the “networkunreachable” mode.

The next section describes other responses taken by application programswhen they receive this notification.

On a Media Connect Event

Notice of the event is passed up the stack, just as in the case of amedia disconnect event, described immediately above. The TCP/IP driver406 passes the notice up to the DHCP service 404. The DHCP servicerequests either a DHCP renew or a DHCP discover, the choice depending onwhether the service has a non-expired or an expired lease at the time ofthe media connect event. The TCP/IP driver gets an IP address and othernetwork configuration information (which may either be a renewal of theconfiguration existing prior to a media disconnect event or may be new).The TCP/IP driver then passes up the stack a “something changed”notification. Higher-level protocol drivers respond to this notificationby tuning their behavior to use the new network connection in the mostoptimal manner possible. Some application programs 306 may not recognizethe notification; they might have to be restarted to ensure that theyuse the new network configuration.

If the computing device 100 were disconnected from one network and thenconnected to another, its DHCP renew or discover request would beanswered with a NACK from the new network's DHCP server. The computingdevice then gets a new address and configuration from the new network'sDHCP server.

If the computing device has a statically configured address, then thereis normally no need for a DHCP renewal or discovery. The static addressis simply replumbed to make the protocol stack operational on the newlyconnected network interface. However, an Address Request Protocolmessage is sent to detect whether the static address is a duplicate ofan address already in use. In the case of a disconnect from one networkfollowed by a connect to another, the computing device can discover towhich network it is connected by sending a DHCP discover. If thecomputing device determines that it is on a different network from theone for which it is configured, it can decide to stay in thedisconnected state, go into the auto-net state in order to gainconnectivity to other auto-net machines, or simply take the returnedDHCP address if the DHCP server is available. A stored policy can tellthe computing device which action to take in this situation.

Once the computing device has discovered and plumbed its new networkconfiguration, it can proceed to do the following. The computing devicerejoins the IP multicast groups it was in before the media disconnectevent. There are two types of groups to be joined—permanent andtemporary. The “all hosts multicast” and “all routers multicast” groupsare examples of permanent groups that all hosts and all routers,respectively, must join. Temporary groups are those that a computingdevice joins as a result of a request from an application program. On amedia connect event, the computing device automatically joins thepermanent groups when the protocol stack is initialized as part of theaddress plumbing. Media sense aware application programs can thenrequest that the computing device rejoin its temporary groups.

If IPsec policies were in effect on the computing device, then theyshould be plumbed correctly. For example, the IPsec policy:

-   -   from/to me to/from <IP addresses or wild card>, use 3DES        encryption and MD5 authentication        should be plumbed. Note that if the IP address changes as a        result of the media connect event, “me” in this IPsec policy        would expand to the new IP address. This ensures that no        information leaks as a result of the change from the former        network to the new.

If a quality of service policy of the type:

-   -   from me to <IP address>, use xx bits/second        were in effect on the computing device, then the computing        device sends RSVP requests for service guarantees of bandwidth        on the network and on the destination. This is done even if the        computing device were disconnected and then connected back to        the same network because the state kept by network elements such        as routers may have timed out between the two media events.

If the computing device is “ICMP router discovery enabled,” then itsends router discovery requests in order to discover the routers on thenetwork. Similarly, the computing device discovers if other servers andservices are available on the new network.

On a Change in Carrier Strength Event

As discussed above, a wireless computing device 114 moving away from oneRAP 116 toward another RAP 118 will probably experience a degradation inthe signal strength of the former RAP while the strength of the latter'ssignal increases. The computing device need not wait for an actual mediadisconnect on the RAP it is using but can anticipate it and respond byscanning for other RAPs. Upon notification of a change in signalstrength, the computing device decides whether it is appropriate toconnect to a new RAP. If so, it makes the connection and triggers amedia connect event specifying the new RAP. Higher-level protocoldrivers and applications are notified that the connection was not lostbut may have changed. In addition, the following actions are taken:

-   -   On choosing to connect to a new RAP (a virtual media connect        event), the computing device sends three Extensible        Authentication Protocol (EAP) start authentication messages to        the new RAP to determine whether it supports authentication,        such as by use of the IEEE 802.1X protocol. If so, then the        computing device completes the authentication process, else it        assumes that it is connected to an unauthenticated network.    -   Once the computing device is authenticated (or decides it is on        an unauthenticated network), it starts the DHCP protocol to get        its address and network configuration. Subsequent steps are the        same as explained above for real media connect events.        On Other Network Media Events

Other network media events described above in the section entitled“Sensing Network Media Events” include a change in the error rate on thecommunications link, a change in the effective throughput on the link,and a change in the response time of some other device on the network.The same principles described above can be used to enable the networklogic to respond to these other network media events.

IV. Actions of Applications upon Notification that Something Changed

As described above, sometimes the network logic can respond to a networkmedia event in such a manner that the application programs need neverknow of the event. More generally, however, the application programs areinformed that something changed so that they may try to alter theiroperations in response to the changed circumstances caused by the event.

On a Network Changed Event

This is a “generic” event, indicating that something has changed but notsaying what. Upon receiving notification of this event, the applicationenquires to determine what has changed. The most common possibilitiesare described below.

Media Disconnect

An application program may choose to close down if it cannot operatewithout network access. On the other hand, some application programs maycontinue to perform as best as they can while waiting to take advantageof a possible reconnect event in the near future. These applicationsinform their users of the problem and, if the original networkconnection cannot be reestablished, they remain ready to take advantageof a new network connection if one becomes available.

Some application programs may not recognize the notification of a mediadisconnect and so cannot immediately respond to the new circumstances.However, as soon as they attempt an operation on the failed networkconnection, they will receive a “network disconnected or unreachable”error and can then respond appropriately.

Media Connect

If there were no working network connections before this event, then theapplication program changes its state from “network unreachable” to“network initializing” and goes through network initialization. Thisinvolves re-registering names and multicast groups on the new network.

Because applications vary widely in purpose one from another, they alsovary widely in how they respond to changes in network connectivity. Somespecific examples are given below.

An Internet browser application may query the new network configurationreceived from the DHCP server to see if the network contains a proxyserver. If so, the browser can set itself up to use the proxy server.

The DNS Resolver service caches DNS server addresses so it is importantthat it notes any changes in those addresses. The new networkconfiguration received from the DHCP server has this information.

The NetBIOS client notes changes to the WINS server addresses (alsofound in the new network's DHCP configuration) and uses those new WINSservers for NetBIOS name registrations, releases, and queries.

The printer service notes changes to the printer addresses (also foundin the new network's DHCP configuration) and uses the new printers forservicing print requests.

An application program that receives a multicast stream via the ScalableReliable Multicast mechanism may check to see if the available bandwidthon the new network connection is lower than it was on the previousnetwork connection. If so, the application may inform the sendingapplication so that it can throttle the send rate and thus avoid dataloss within the network and subsequent retransmissions. In a likemanner, an application sending a multicast stream may check theavailability of bandwidth on the new network connection and adjust itssend rate accordingly.

While the computing device was not connected to the network, a logonservice may have granted access to a user on the basis of cachedcredentials. On reestablishing the network connection, the logon servicecan query a security server for the logon credentials.

V. The NLRSP: Providing Network Connectivity Information

The section immediately preceding this one gives examples ofapplications' responses to network media connect events. Becauseapplications may need to adapt their behavior to the nature of thelogical networks to which their host computer is attached, theapplications seek to discover the nature of a newly connected network bycommunicating with devices on that network. Complications arise becausenetworks differ in the set of discovery techniques applicable to them.Accordingly, one aspect of the present invention removes the burden ofsupporting all of the various discovery techniques from theapplications. In accordance with the present invention, a set ofservices, for the sake of discussion called the Network LocationResolution Service Provider (NLRSP), is provided by the host computer todiscover aspects of the new network connections. The discoveredinformation is provided to applications through a common API.

FIG. 5 shows the steps followed by one embodiment of the NLRSPinvention. In Step 500, the NLRSP contacts the drivers of the networkinterfaces on the computer to discover which interfaces are currentlyconnected to networks. In some embodiments, the NLRSP simply polls allthe network drivers for this information. In other embodiments, theNLRSP registers with the drivers to be automatically notified wheneverthe driver senses a network connect event.

In step 502 of FIG. 5, the NLRSP constructs names for each logicalnetwork connected to the computer. The name given to a logical networkis created by the NLRSP in such a manner that the combination of thename and the method through which the name was obtained uniquelyidentifies the logical network within the context of the computer. TheNLRSP also tries to generate names in such a manner that there is a“one-to-one” mapping between the names and the logical networks. Thisone-to-one mapping has two fundamental properties. First, differentlogical networks are given different names. Second, a given logicalnetwork is given the same name whenever the computer connects to it.These properties are called “uniqueness” and “persistence,”respectively. Because the network names are unique and persistent,applications may rely on them when selecting a configuration to use witha given logical network.

In order to try to construct a name that is both unique and persistent,the NLRSP follows a set formula for applying information it discoversabout the network. First, the NLRSP searches the logical network forinformation, and only when it has enough information about the networkdoes it construct a name that applies to no other network (uniqueness).Information used by embodiments of the NLRSP to construct network namesincludes the domain name of the network (obtainable via DHCP), staticinformation entered by a user to name a network, and subnet addresses.On networks that support the 802.1X authentication protocol, the NLRSPcan construct a network name based on the network identity stringreturned in an EAP Identity Request message. Second, by following a setformula, the NLRSP usually constructs the same name for the same logicalnetwork (persistence). Different embodiments of the invention may dependupon different methods for gathering logical network information, andsome of these methods may, in certain circumstances, lead to names thatviolate either the uniqueness or the persistence property of an idealmapping. The text accompanying FIGS. 9, 10A, and 10B explain some ofthese situations and show why the information provided by the inventionis still useful.

Step 504 of FIG. 5 illustrates that in some embodiments of the presentinvention, the NLRSP correlates the network name it constructs withother information. A globally unique identifier (GUID) may be given thatidentifies the computer's physical network interface through which thenetwork is accessible. The GUID can be used by the application whenasking for more information about the interface. The network name isalso correlated to the APIs of the transport protocols supported by thenetwork. Other information correlated to the network name may includethe type of the network interface (e.g., Ethernet or Point-to-PointProtocol), the speed of the network interface, the name of the networkaccess device which supports the network interface, and the port on thenetwork access device through which this connection to the network ismade. If the computer has multiple interfaces to the same logicalnetwork, then the NLRSP may generate information about each interface,and, while the network name for each interface will be the same, thedifferent interfaces can be distinguished by their GUIDs.

In Step 506 of FIG. 5, the NLRSP presents its information toapplications. Applications ask for information and may register to beinformed when the information changes. The NLRSP keeps track of theinformation given to an application and notifies the applicationwhenever any of the information given changes or when new informationbecomes available.

FIGS. 6A and 6B illustrate the above points. FIG. 6A shows a laptop PC100 and three locations where the laptop's owner may wish to use it. Ineach of the three locations, the user connects the laptop to a logicalnetwork and the NLRSP discovers information about the logical networkand creates a name for it. When the user is at home, her laptopcommunicates with the Internet via a dial-up link to a local Internetservice provider (ISP). The NLRSP names this logical network“myISP.net.” At the user's desk at work, the laptop connects to thecorporate LAN 106. The NLRSP queries servers on the LAN and names thatlogical network “worldWideWork.com.” Finally, the user takes her laptopwhen she volunteers at a local agency. The NLRSP names this logicalnetwork “helpingOut.org.” It is important to realize that the specificname given by the NLRSP need not be intrinsically descriptive.Applications can rely on the name as long as it is unique andpersistent.

FIG. 6B shows, for each of the three locations of FIG. 6A, the networkinformation 600 provided by the NLRSP. The network name 602 created bythe NLRSP is discussed in relation to FIG. 6A. The NLRSP identifies theinterface 604 through which the logical network can be accessed. Here,that identifier is the GUID of the hardware that supports the computer'sphysical interface to the logical network. In some embodiments, theNLRSP correlates the network name with other information thatapplications frequently need. The information provided by the NLRSP inFIG. 6B includes the type of the interface 606 and the nominal speed 608supported by that interface. If an application needs even moreinformation, it can use the interface identifier 604 to ask for it.

FIG. 6B also shows the configuration a particular application may choosewhen the laptop 100 is connected to a logical network at a givenlocation. Here, the application uses one configuration 610 for both homeand volunteer agency network connections and a separate configuration612 when at work. The NLRSP does not force the application to use adifferent configuration for each different network connection; it simplyenables the application to do so, at the user's discretion.

FIGS. 7A and 7B illustrate a complication to the scheme identifiedabove. Here the laptop PC 100 is at the user's home and the NLRSP hasnamed the logical network connection “myISP.net.” The user uses thatconnection to log into work, in the process setting up a virtual privatenetwork connection to the network at her work location. In someembodiments of the NLRSP, a second network name is added to the first.The NLRSP creates “worldWideWork.com” to describe a virtual, rather thana physical, network connection. This is shown by the interface type 606of the new connection, “PPP,” which indicates a point-to-point virtualconnection. In order to choose the configuration best adapted to thisconnectivity situation, an application consults both network namescreated by the NLRSP.

FIGS. 8A through 8C illustrate a different complication, this one due tothe networking technology called Network Address Translator (NAT). NATallows several computing devices connected in one location to share asingle connection to the Internet. In FIG. 8A, the user comes home andsets up a connection to work but she need not dial-up myISP.net as shedid in the scenarios of FIGS. 6A and 7A. Instead, she connects thelaptop PC 100 to her home LAN 106 and shares the Internet connectionalready established by the server computing device 800. This is acomplication because a straightforward embodiment of the NLRSP runningon the laptop might produce the information shown in FIG. 8B. Thatinformation, accurate as far as it goes, does not indicate the dial-upconnection which is the most likely source of network troubles andbottlenecks. In FIG. 8C, a fuller embodiment of the NLRSP complementsthe information shown in FIG. 8B with information about the dial-upconnection. Applications using the information provided in FIG. 8C canget a more complete picture of the connectivity scenario in which theyare working and can respond accordingly.

In certain circumstances, it may be very difficult to create a mappingthat conforms to the strict requirements of uniqueness and persistence.In FIG. 9, as in FIG. 6A, the ISP provides the same network name to allits dial-in customers. If a user and her neighbor subscribe to the sameISP, then a laptop 100 will report the same network name (“myISP.net”)whether it is connected at the user's home or at her neighbor's house.This mapping may violate the uniqueness property because it uses thesame network name for connections originating from two differentlocations. However, this mapping may still be useful in choosing whichnetwork configuration to use because the user would most likely want touse the same network configuration when dialing into her ISP regardlessof her location when dialing.

In the scenario depicted in FIGS. 10A and 10B, the property ofpersistence is violated. One night, a system administrator changes thename of the corporate network from “worldWideWork.com” to“captivatingCareer.com.” When the user plugs in her laptop 100 at workthe next day, the invention maps the corporate network to the name“captivatingCareer.com.” The mapping is not persistent because the samenetwork is given different names on different days. Although the laptophas no configuration stored for use with the new name, this problem iseasily remedied. The laptop presents the new network name to the userand asks for guidance as to which configuration to use. Realizing whathappened, the user directs her laptop to use the configuration onceassociated with “worldWideWork.com.”

FIGS. 11A, 11B, 11C, and 11D illustrate another type of informationgathered by the NLRSP about the networks connected to the host computer.This information relates primarily to the other devices connected to thenetwork. A network may be of one of four “connectivity types” and FIG.11A is a network diagram showing a computing device 100 connected tofour different types of networks. (It is unlikely that one device wouldbe connected to one network of each connectivity type, but it is notimpossible, and this configuration is useful for illustrative purposes.)The NLRSP probes the networks for information and uses an algorithm suchas the one portrayed in FIG. 11B to determine the connectivity type ofeach network. The specifics of the FIG. 11B algorithm are pertinent tothe IP protocol, but the general method is widely applicable. Network1100 is called an “ad hoc” network, defined to be a network notconnected to any other network. The NLRSP determines this in step 1110by noting that the host computing device's address on this network is inthe private IP address range 169.254.0.0 through 169.254.255.255 and bynoting that there is no gateway on the network. Network 1102 is a“managed” network, determined in step 1112 by the host 100 having avalid address (not 0.0.0.0) not in the private domain range of an ad hocnetwork, the presence in the host's configuration for this networkconnection of a DNS server with address other than 127.0.0.1, and thehost having a domain configured. The NLRSP contacts the DNS server 1108to see that it exists. Network 1104 is called “unmanaged” because it ison the private side of a NAT server 800. (For a description of NAT, seethe text accompanying FIG. 8A). The NLRSP determines that this is anunmanaged network in step 1114 because it receives an InternetConnection Service (ICS) beacon periodically broadcast by the NATserver. (As a practical matter, it may take so long to detect the beaconthat the NLRSP returns the connectivity type before detecting it.)Finally, network 1106 is of connectivity type “unknown” because theNLRSP's tests in steps 1110, 1112, and 1114 are not determinative of anyof the three previous network types. A declaration of type “unknown”also results whenever the interface is not connected to a networkbecause this algorithm depends upon information gathered from thenetwork. When the interface becomes connected to a network, thealgorithm is re-run to determine the connectivity type of the newconnection.

In addition to determining the connectivity type of the networks, theNLRSP checks to see if each network provides connectivity to theInternet. FIG. 11C shows how this may be accomplished. In step 1116, theNLRSP checks some preliminary information. Then, in step 1118, the NLRSPtries to resolve an Internet name. The particular name used is of littleimportance. If the name is resolved, then the network has connectivityto the Internet.

FIG. 11D is a block diagram showing network connectivity type andInternet connectivity information for the four networks of FIG. 11A.Note that by definition a network with connectivity type “ad hoc” doesnot have Internet connectivity. The network connectivity type andInternet connectivity information are returned for each network asoptional fields added on to the block 600, first shown in FIG. 6B.

In some circumstances, domain administrators need to set up grouppolicies to tailor network usage. These policies are preferably based onconnectivity information presented by the NLRSP. For example, an ICSgroup policy may allow users to enable and run ICS at home but prohibitthem from using ICS if the NLRSP detects that the computer is connectedto a corporate network. Similarly, for safety's sake, a user may run afirewall application to guard the computer's network links if the useris at home or on the road. However, that firewall application becomesmerely a nuisance if it is run on links to a network already protectedby a dedicated firewall, such as a corporate network. The group policymay disable the firewall for those links, and only for those links,connected to the corporate network. Many other scenarios can be imaginedwhere group policies are based on knowing the specific networks to whicha computer is connected.

VI. An NLRSP API According to One Aspect of the Invention

This section details one embodiment of the present invention, directedtoward Microsoft's “WINDOWS” operating system. In this embodiment, theinvention is presented as an API that allows applications to enumerateall of the logical networks currently accessible from the application'shost computer, to identify the name given to a logical network, and toidentify the transport address of the physical network interface to alogical network. In addition, the WSANSPIoctl function is used to notifyapplications when information previously provided to them changes.

WSANSPIoctl

The Windows Sockets WSANSPIoctl function provides a method for makingInput/Output control calls to a registered namespace. It has thefollowing structure:

INT WSAPI WSANSPIoct1 ( HANDLE hLookup, DWORD dwControlCode, PVOIDpvInBuffer, PD WORD pcbInBuffer, PVOID pvOutBuffer, PDWORD pcbOutBuffer,PWSACOMPLETION pCompletion );Parameters:

hLookup

-   -   [in] Lookup handle returned from a call to        WSALookupServiceBegin.

dwControlCode

-   -   [in] The control code of the operation to perform.

pvInBuffer

-   -   [in] A pointer to the input buffer for the operation.

cbInBuffer

-   -   [in/out] The size of the input buffer for the operation.

pvOutBuffer

-   -   [out] A pointer to the output buffer for the operation.

pcbOutBuffer

-   -   [in/out] A pointer to an integral value for the size of the        output buffer.

pCompletion

-   -   [in] A pointer to a WSACOMPLETION structure.        Return Value:

Upon successful completion, WSANSPIoctl returns NO_ERROR. Otherwise, avalue of SOCKET_ERROR is returned, and a specific error code can beretrieved by calling WSAGetLastError.

Error Codes:

WSANOTINITIALISED

-   -   A successful call to NSPStartup was not performed.

WSA_INVALID_HANDLE

-   -   hLookup was not a valid query handle returned by        WSALookupServiceBegin, or a handle passed in pCompletion was        invalid.

WSAEFAULT

-   -   The pvInBuffer, pcbInBuffer, pvOutBuffer, pcbOutBuffer, or        pCompletion argument is not totally contained in a valid part of        the user address space. Alternatively, the cbInBuffer or        cbOutBuffer argument is too small, and the argument is modified        to reflect the required allocation size.

WSAEOPNOTSUPP

-   -   The specified dwControlCode is unrecognized.

WSAEINVAL

-   -   A supplied parameter is not acceptable, or the operation        inappropriately returns results from multiple namespaces when it        does not make sense for the specified operation.

WSA_NOT_ENOUGH_MEMORY

-   -   There were insufficient resources to perform the requested        operation.

WSAEWOULDBLOCK

-   -   A non-blocking (polling) request was issued and the desired        condition was unsatisfied. If dwControlCode was set to        SIO_NSP_NOTIFY_CHANGE, a polling change-notification request was        made and nothing about the resulting data has changed.

WSA_OPERATION_ABORTED

-   -   A blocking request was unable to complete.

WSASYSCALLFAILURE

-   -   An APC completion was indicated in pCompletion and the operation        completed immediately, but the system failed to queue a thread        to complete the APC.        Remarks:

The WSANSPIoctl function is used to set or retrieve operating parametersassociated with a namespace query handle.

Any IOCTL may block indefinitely, depending upon the relevantnamespace's implementation. If an application cannot tolerate blockingin a WSANSPIoctl call, it uses overlapped Input/Output. For theseoperations, which cannot be completed immediately, completion isindicated later through the mechanism specified in the pCompletionparameter, which is a pointer to a WSACOMPLETION structure. IfpCompletion is NULL, this is a blocking call. To make this callnon-blocking and return immediately, set WSACOMPLETION::Type toLUP_NOTIFY_IMMEDIATELY.

WSACOMPLETION typedef struct_wsacompletion { enum_type {LUP_NOTIFY_IMMEDIATELY, LUP_NOTIFY_HWND, LUP_NOTIFY_EVENT,LUP_NOTIFY_PORT, LUP_NOTIFY_APC }Type; PVOID Recipient; UINT_PTRCompletion; PWSAOVERLAPPED Overlapped; }

Members:

-   -   Type        -   Indicates the type of Recipient.    -   Recipient        -   Either an HWND, HANDLE to an event or completion port, or            function address for an asynchronous procedure call.    -   Completion        -   For Type LUP_NOTIFY_HWND, this is the window message            identifier to send. For Type LUP_NOTIFY_PORT, this is the            completion key to use.    -   Overlapped        -   Used in overlapped operations.

The following IOCTL code (command) is supported by NLA:SIO_NSP_NOTIFY_CHANGE

This operation checks if the query results returned via calls toWSALookupServiceBegin and WSALookupServiceNext remain valid. IfpCompletion is NULL, this operation is a poll and returns immediately.If the query set remains valid, WSAEWOULDBLOCK is returned to indicatethat later invalidation will require an asynchronous notification. Ifthe query set has changed and is invalid, NO_ERROR is returnedindicating success in polling for invalidation of the query set. Not allname resolution protocols will be able to support this feature and thusthis call may fail with WSAEOPNOTSUPP. A query containing data frommultiple providers cannot call this IOCTL and will return WSAEINVAL.

pvInBuffer, pcbInBuffer, pvOutBuffer, and pcbOutBuffer are ignored.

Some protocols may simply cache the information locally and invalidateit after some time, in which case a notification is issued to indicatethat the local cache has been invalidated.

For name resolution protocols where changes are infrequent, it ispossible for a namespace service provider to indicate a global changeevent that may not be applicable to the query on which changenotification was requested and issued.

Immediate poll operations are usually much less expensive because theydo not require a notification object. In most cases, this is implementedas a simple Boolean variable check. Asynchronous notification, on theother hand, in addition to expenses related to the notification objectinvolved with signaling the change event, may (depending on theimplementation of the namespace service provider) necessitate thecreation of dedicated worker threads or inter-process communicationchannels.

To cancel an asynchronous notification request, simply end the originalquery with a WSALookupServiceEnd call on the affected query handle.Canceling asynchronous notification for LUP_NOTIFY_HWND will not postany message, however an overlapped operation will be completed, andnotification will be delivered with the error WSA_OPERATION_ABORTED.

Upon signaling an invalidation of query data, a namespace should permit,through extended semantics of WSALookupServiceNext, an application toquery what about the data has changed.

Queries

Queries are performed using the following namespace calls.NSPLookupServiceBegin

The returned lphHandle for the query is an internal LPNLA_QUERY_HANDLEstructure allocated on a private heap for the namespace. It is treatedas an opaque object by the application and not modified. It is not atrue handle so WSAGetOverlappedResult cannot be used. The resultingquery set comprises the adapter enumeration from GetAdaptersInfo and aregistry-merge of non-active, saved network names. Registry-merge is theprocess of obtaining user-specific, persistent network names fromHKEY_CURRENT_USER, combining the resulting list with global-system,persistent network names from HKEY_LOCAL_MACHINE, matching or addingthem as appropriate to the adapter enumeration list, and producing alist of WSAQUERYSETW structures.

LUP_RETURN_NAME, LUP_RETURN_COMMENT, LUP_DEEP, and LUP_RETURN_BLOB maybe set in dwControlFlags. These affect the output from future calls toNSPLookupServiceNext. Future calls only return the networks that containthe requested fields. For example, if LUP_RETURN_BLOB is requested, thenonly those networks with blob (binary large object) information will bereturned from calls to NSPLookupServiceNext regardless of which controlsflags are passed in. When LUP_DEEP is specified, NLA returns extendednetwork information which may take a long time to acquire.

Error Codes:

WSANOTINITIALISED

-   -   A successful call to NSPStartup was not performed.

WSASERVICE_NOT_FOUND

-   -   lpProviderId or lpqsRestrictions->lpServiceClassId was an        invalid GUID.

WSAEINVAL

-   -   A parameter was not validated, or        lpqsRestrictions->lpafpProtocols contains something other than        IP-based protocols, or dwControlFlags contains an invalid flag.        Alternatively, network or friendly name filtering was indicated        by lpqsRestrictions->lpszServiceInstanceName, or there was a        non-NULL lpqsRestrictions->lpszComment, and LUP_RETURN_NAME or        LUP_RETURN_COMMENT was not specified in dwControlFlags,        respectively.

WSANO_DATA

-   -   LUP_CONTAINERS was specified in dwControlFlags.

WSAEFAULT

-   -   An access violation occurred while reading from or writing to        user-supplied parameters.

WSA_NOT_ENOUGH_MEMORY

-   -   The system was unable to allocate a query handle or share memory        from a system service.

WSAEACCESS

-   -   The calling thread lacked security permissions to access the        user-persistent networks.

WSAESYSNOTREADY

-   -   The NLA system service was not available.        NSPLookupServiceNext

First, the lphHandle is checked to see that it is a true handle returnedby NSPLookupServiceBegin. If valid, a new WSAQUERYSETW is copied intolpqsResults. If LUP_RETURN_BLOB was specified and various informationabout the networks exists, the information is returned inlpqsResults->lpBlob. Pointers in the view of the mapped file are offsetrelative to the beginning of each individual WSAQUERYSETW. These arechanged to actual addresses in the namespace's process address spacebefore being returned from this call. The resulting WSAQUERYSETW isformatted as follows.

LUP_RETURN_NAME, LUP_RETURN_COMMENT, and LUP_RETURN_BLOB may be set indwControlFlags. These are independent of those supported inNSPLookupServiceBegin.

Upon receiving a WSA_E_NO_MORE from a WSALookupServiceNext call, ifWSANSPIoctl was called with SIO_NSP_NOTIFY_CHANGE which succeededimmediately or returned pending, then WSALookupServiceNext may be calledagain to enumerate those networks that have changed. dwOutputFlags willcontain one of the following:

RESULT_IS_ADDED

RESULT_IS_CHANGED

RESULT_IS_DELETED

A change can be indicated when any field which was requested at the timeof WSALookupServiceBegin changes in any way.

When the enumeration completes, WSA_E_NO_MORE is received. ASIO_NSP_NOTIFY_CHANGE may be reissued at any time.

Error Codes:

WSANOTINITIALISED

-   -   A successful call to NSPStartup was not performed.

WSAEINVAL

-   -   lpdwBufferLength was NULL, dwControlFlags has an invalid value,        or LUP_FLUSHPREVIOUS was specified when there was nothing to        flush.

WSA_INVALID_HANDLE

-   -   hLookup is not a valid query handle returned by        NSPLookupServiceBegin.

WSAESYSNOTAVAIL

-   -   The NLA system service is not available.

WSAEACCESS

-   -   The calling thread lacked security permissions to access the        user-persistent networks.

WSAEFAULT

-   -   lpdwBufferLength indicated a buffer in lpqsResults too small to        hold the resulting WSAQUERYSETW. The size required is returned        in lpdwBufferLength. If the application is unable to supply a        buffer of the specified size, it calls WSALookupServiceNext with        dwControlFlags set to LUP_FLUSHPREVIOUS to skip over the entry.        Alternatively, an access violation occurred while writing data        to the buffer supplied in lpqsResults.

WSA_NOT_ENOUGH_MEMORY

-   -   The namespace is unable to acquire network information from the        NLA system service due to a lack of memory in the calling        process.

WSA_E_NO_MORE

-   -   No more networks are left to enumerate in the query result.

WSAESYSNOTREADY

-   -   The NLA system service is not available.        NSPLookupServiceEnd

The lookup handle is deallocated from the namespace private heap, and ifthe reference count hits zero, the LPC connection to the service isclosed.

Error Codes:

WSANOTINITIALISED

-   -   A successful call to NSPStartup was not performed.

WSA_INVALID_HANDLE

-   -   hLookup was not a valid query handle returned by        NSPLookupServiceBegin.        NLA_BLOB

When LUP_RETURN_BLOB is specified for a given query, NLA attachesrelevant NLA_BLOB entries to the resultant data in calls toNSPLookupServiceNext via (PNLA_BLOB)lpqsResults->lpBlob->pBlobData withthe following format:

typedef enum_NLA_BLOB_DATA_TYPE { NLA_RAW_DATA = 0, NLA_INTERFACE = 1,NLA_802_1X_LOCATION = 2, NLA_CONNECTIVITY = 3, // LUP_DEEP required.NLA_ICS = 4, // LUP_DEEP required. }NLA_BLOB_DATA_TYPE,*PNLA_BLOB_DATA_TYPE; typedef enum_NLA_CONNECTIVITY_TYPE {NLA_NETWORK_AD_HOC = 0, NLA_NETWORK_MANAGED = 1, NLA_NETWORK_UNMANAGED =2, NLA_NETWORK_UNKNOWN = 3, }NLA_CONNECTIVITY_TYPE*PNLA_CONNECTIVITY_TYPE; typedef enum_NLA_INTERNET {NLA_INTERNET_UNKNOWN = 0, NLA_INTERNET_NO = 1, NLA_INTERNET_YES = 2,}NLA_INTERNET, *PNLA_INTERNET; typedef struct_NLA_BLOB { struct {NLA_BLOB_DATA_TYPE type; DWORD dwSize; DWORD nextOffset; }header; union{ // header.type −> NLA_RAW_DATA CHAR rawData[1]; //header.type −>NLA_INTERFACE struct { DWORD dwType; DWORD dwSpeed; CHAR adapterName[1];} interfaceData; //header.type −> NLA_802_1X_LOCATION struct { CHARinformation[1]; } locationData; //header.type −> NLA_CONNECTIVITY struct{ NLA_CONNECTIVITY_TYPE type; NLA_INTERNET internet; } connectivity;//header.type −> NLA_ICS struct { struct { DWORD speed; DWORD type;DWORD state; WCHAR machineName[256]; WCHAR sharedAdapterName[256]; }remote; } ICS; } data; } NLA BLOB, *PNLA_BLOB, *FAR LPNLA_BLOB;Notification Mechanism

To eliminate the need for worker threads in the namespace dynamiclibrary to wait upon change notification events and then translate theminto the user-requested notification type, an NLA system service,running as localsystem under svchost.exe, is used. This also minimizesthe number of recipients of change events to a single process for theentire system which then filters out the events only to the processesthat are interested in such changes.

Upon system startup, the NLA service starts an LPC server port in aworker thread. It then blocks waiting for connection andnotification-change registrations from a process using the namespace.When a new connection is registered, a FILE_MAP_READ file mapping handleis given to the calling client, and an LPC request is issued to obtainthe network data separately.

When WSANSPIoctl is invoked upon a valid query handle with the operationSIO_NSP_NOTIFY_CHANGE, the service is given a duplicate of the query'sregistry key handle, and a change notification request is registered viathe LPC connection. When the DHCP service signals in the service's mainthread, the service reconstructs the file mapping, performs all clientchange-notifications, and clears the registration list. If a particularuser registry key updates, that particular registration is notified andremoved from the registration list. If an LPC connection is broken, theservice removes that application's query sets from the registration set.

Superfluous notifications are permissible.

Network Persistence and Friendly Names

The mapping method maintains its quality of persistence even through theperiod during which a network is not active. That is to say, a networkis given the same name whether or not that network is currently active.This property allows an application to configure to an inactive network,waiting for the network to become active.

NSPSetService

Parameters:

-   -   lpqsRegInfo        -   This WSAQUERYSETW is either from a query result or is            manually constructed.            essOperation            Supported Operations:    -   RNRSERVICE_REGISTER        -   The supplied network WSAQUERYSETW from lpqsRegInfo is made            persistent in the fashion indicated by dwControlFlags.

RNRSERVICE_DELETE

-   -   If the supplied network WSAQUERYSETW from lpqsRegInfo is        persistent, then it will be removed.        dwControlFlags

The operation performs an essOperation with either or both of thefollowing options:

NLA_FRIENDLY_NAME

-   -   The lpszComment field of the supplied network WSAQUERYSETW from        lpqsRegInfo is valid and will be stored persistently. This        cannot be specified with RNRSERVICE_DELETE, instead use        RNRSERVICE_REGISTER with a NULL-terminated string to clear a        friendly name.

NLA_ALLUSERS_NETWORK

-   -   The entry is stored persistently under HKEY_LOCAL_MACHINE,        making it available during queries to all users on the local        machine. To delete a network from under HKEY_CURRENT_USER, this        flag must not be specified. This flag is only valid in the        security context of a local system administrator.        Error Codes:

WSANOTINITIALISED

-   -   A successful call to NSPStartup was not performed.

WSASERVICE_NOT_FOUND

-   -   lpProviderId indicated an invalid provider, or        lpqsRegInfo->lpServiceClassId indicated a service not provided        by this namespace.

WSAEINVAL

-   -   essOperation or lpqsRegInfo was invalid. The network name may be        missing in lpqsRegInfo->lpszServiceInstanceName, or a friendly        name may be missing in lpqsRegInfo->lpszComment when        NLA_FRIENDLY_NAME is specified in dwControlFlags or when        lpqsRegInfo->lpVersion, lpqsRegInfo->lpBlob,        lpqsRegInfo->lpszContext, or lpqsRegInfo->lpcsaBuffer is        non-NULL. Also, this error can be returned when        RNRSERVICE_DELETE is requested in essOperation while specifying        NLA_FRIENDLY_NAME in dwControlFlags. To clear a friendly name,        use RNRSERVICE_REGISTER with a NULL-terminated string for the        friendly name.

WSAEFAULT

-   -   An access-violation occurred while examining the supplied        parameters.

WSAEACCESS

-   -   NLA_ALLUSERS_NETWORK was specified in dwControlFlags while not        in the security context of a local system administrator, or the        calling thread lacked the access to store the information for        the current user, or RNRSERVICE_DELETE was specified for a        persistent network which did not exist.        Application Termination

Because LPC is used, cleanup is simple as the NLA service will benotified of port closure.

The embodiments described above are illustrative only and are notintended to limit the scope of the present invention. In particular, theembodiments describe the invention with respect to TCP/IP networkingtechnologies and with respect to Microsoft “WINDOWS” operating systemsbut the invention applies as well to other networking technologies andto other computer technologies. The invention applies to all networks,to wireless as well as to wired network technologies. Therefore, theinvention as described herein contemplates all such embodiments as maycome within the scope of the following claims and equivalents thereof.

1. A method for providing network connectivity information to anapplication running on a computing device, the method comprising:gaining connectivity to a network; discovering aspects of the network;associating a first name with the network, the first name unique withinthe context of the computing device; providing the first name to theapplication as a key for accessing the discovered aspects of thenetwork; losing connectivity to the network; regaining connectivity tothe network; rediscovering aspects of the network; associating a secondname with the network, wherein the second name is the same as the firstname; and correlating the first name with application programminginterfaces of transport protocols supported by the network foridentifying the computer's logical network attachments.